package com.ztf.reflection;

import java.lang.reflect.Array;

public class ArrayTester1
{
    public static void main(String[] args) throws Exception
    {
        Class<?> classType = Class.forName("java.lang.String");

        //生成数组，指定元素类型和数组长度
        Object array = Array.newInstance(classType, 10);

        Array.set(array, 5, "hello");
        String str = (String)Array.get(array, 5);

        System.out.println(str);

    }

}